package info.maxhis.entity;

import info.maxhis.util.CalendarUtil;

/**
 * 实体类
 * 
 * @author iStar
 * 
 */
public class Friend implements Comparable<Object> {
	
	private String name,phone,headurl;
	private String uid;//人人网返回的uid，保存到数据库中在防止重复添加
	private int id,birthYear, birthMonth, birthDay,days2Birthday;
	private int dateType;//生日类型，公历或农历，默认为公历
	private String sign; //星座

	public Friend() {
		dateType = CalendarUtil.DATE_TYPE_SOLAR;
	}

	public Friend(String name, int birthYear, int birthMonth, int birthDay) {
		this();
		this.name = name;
		this.birthYear = birthYear;
		this.birthMonth = birthMonth;
		this.birthDay = birthDay;
		days2Birthday = CalendarUtil.daysLeft2Birthday(this);
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getBirthYear() {
		return birthYear;
	}

	public void setBirthYear(int birthYear) {
		this.birthYear = birthYear;
	}

	public int getBirthMonth() {
		return birthMonth;
	}

	public void setBirthMonth(int birthMonth) {
		this.birthMonth = birthMonth;
	}

	public int getBirthDay() {
		return birthDay;
	}

	public void setBirthDay(int birthDay) {
		this.birthDay = birthDay;
	}

	public int getDays2Birthday() {
		return days2Birthday;
	}

	public void setDays2Birthday(int days2Birthday) {
		this.days2Birthday = days2Birthday;
	}

	public int getDateType() {
		return dateType;
	}

	public void setDateType(int dateType) {
		this.dateType = dateType;
	}

	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getHeadurl() {
		return headurl;
	}

	public void setHeadurl(String headurl) {
		this.headurl = headurl;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	@Override
	public String toString() {
		return "Friend [name=" + name + ", id=" + id + ", birthYear="
				+ birthYear + ", birthMonth=" + birthMonth + ", birthDay="
				+ birthDay + "]";
	}

	@Override
	public int compareTo(Object o) {
		if (o instanceof Friend) {
			Friend f = (Friend) o;
			return CalendarUtil.daysLeft2Birthday(this) - CalendarUtil.daysLeft2Birthday(f);
		}
		return 0;
	}

}
